﻿@model JinRi.WebHost.ViewModels.BannerModel
@using ServiceStack
@{
    ViewBag.Title = "首页";
    var images = new List<string>
    {
        Url.Content("~/Images/index-big-light.png"),
        Url.Content("~/Images/index-earth.png"),
        Url.Content("~/Images/index-geometry.png"),
        Url.Content("~/Images/index-icon.png"),
        Url.Content("~/Images/index-person.png"),
        Url.Content("~/Images/index-small-light.png"),
        Url.Content("~/Images/index-word.png"),
    };
    var str = images.ToJson();
}

@if (Model == null || Model.Introduce == null || Model.Introduce != "1")
{

    <div class="a1"></div>
    <div class="a2"></div>
    <div class="container clearfix">
        <div class="a3"></div>
        <div class="a4"></div>
        <div class="a5"></div>
        <div class="a6"></div>
        <div class="a7"></div>
    </div>
    <div class="loading">
        <div><img src="~/Images/loading-spinning-bubbles.svg" width="64" height="64" alt="Loading" /></div>
        <div class="text">loading...</div>
    </div>
}
else
{
    if (Model != null && Model.ImageId != Guid.Empty)
    {
        <div class="banner">
            <img src="@Url.Action("Get", "Image", new { id = Model.ImageId })" />
        </div>
    }
}


@section scripts
{
    @if (Model == null || Model.Introduce == null || Model.Introduce != "1")
    {
        <script src="~/Scripts/jquery.imgpreload.min.js"></script>
        <script>
            var images = @Html.Raw(str);
            $.imgpreload(images, function() {
                $('.loading').hide();
                $('.body .container').addClass('an');
                $('.body .a1').addClass('an');
                $('.body .a2').addClass('an');
            });
        </script>
    }
}
